unit UnitHuaCi;

interface

uses
  Windows;

type
  TStartCB = function(form1handle: longWord): Boolean; stdcall;
  TStopCB = function: Boolean; stdcall;
  TGetFromCBW = procedure; stdcall;
  TSelModelCB = procedure(HuaSel: Boolean; DBCSel: Boolean); stdcall;
  TMouseProcCB = function(mouseModel: Integer): Boolean; stdcall;

var
  LibHandleCB: Integer;
  StartCB: TStartCB;
  StopCB: TStopCB;
  GetFromCBW: TGetFromCBW;
  SelModelCB: TSelModelCB;
  MouseProcCB: TMouseProcCB;

  procedure OpenHuaCiAPI;
  procedure CloseHuaCiAPI;

implementation

procedure OpenHuaCiAPI;
begin
  LibHandleCB := Loadlibrary('CLCBNt.dll');
  if LibHandleCB<>0 then
  begin
    @StartCB := getprocAddress(LibHandleCB ,'StartCB');
    @StopCB := getprocAddress(LibHandleCB ,'StopCB');
    @GetFromCBW := getprocAddress(LibHandleCB ,'GetFromCBW');
    @SelModelCB := getprocAddress(LibHandleCB ,'SelModelCB');
    @MouseProcCB := getprocAddress(LibHandleCB, 'MouseProcCB');
  end
  else begin
    Halt;
  end;

  if (@StartCB=nil)or(@StopCB=nil)or(@GetFromCBW=nil)or(@SelModelCB=nil)or(@MouseProcCB=nil) then
  begin
    Halt;
  end;              
end;

procedure CloseHuaCiAPI;
begin
  if LibHandleCB<>0 then
  begin
    FreeLibrary(LibHandleCB);
  end;
end;

end.
